

#ifndef __PUB_LIB_H__
#define __PUB_LIB_H__


#include <stdarg.h>
#include <syslog.h>
#include "pub_lib.c"

struct pack_head {
        int     len;
        int     version;
        int     command;
        int     reserve;
};

struct pack_data {
        int     len;
        char    *buffer;
};


#define MAXBUF 		1024
#define SERVER_PORT	8383
#define SERVER_LISTEN	5
#define TIMEOUT		3


#define HARDINFO	0x0001
#define SYSTEMID	0x0002
#define LICENSE		0x0003

#define MAX_S(i,j)	(((i)>(j))?(i):(j))

//openssl genrsa -out privkey.pem 2048
//openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095

void do_log( const char *fmt,...)
{
	char puffer[1024];
	va_list az;

	va_start(az,fmt);
	vsnprintf(puffer, 1000, fmt, az);
	openlog("REGISTER", LOG_PID|LOG_CONS, LOG_DAEMON);
	syslog(LOG_NOTICE, "%s\n", puffer);
	closelog();
	va_end(az);
}

void do_log2( const char *fmt,...)
{
	char puffer[1024];
	va_list az;

	va_start(az,fmt);
	vsnprintf(puffer, 1000, fmt, az);
	openlog("REGISTER", LOG_PID|LOG_CONS, LOG_LOCAL7);
	syslog(LOG_INFO, "%s\n", puffer);
	closelog();
	va_end(az);
}



#endif
